<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 创建Ajax对象
        new xhr =  XMLHttpRequest()
        //传入请求方式和地址
        xhr.open('GET','http://127.0.0.1:3000/getData')
        //发送请求
        xhr.send()
        //获取服务器响应数据
        xhr.onload = function() {
            console.log(xhr.responseText)
        }

    </script>
</body>
</html>